package src;

public class Airport implements IAirport {
	private int countFlights;

	private IFlight listFlights[] = new IFlight[100];

	public void addFlightInList(IFlight flight) {
		if (countFlights < 100) {
			listFlights[countFlights] = flight;
			countFlights = countFlights + 1;
			System.out.println("Flight number"+flight.getNumberFlight()+" add to airport");
		} else {
			System.out.println("Impossible to create a flight");
		}
	}

	public void markFlightLate(int numberOfFlight) {
		for (IFlight flight : listFlights) {
			if (flight!=null && flight.getNumberFlight() == numberOfFlight) {
				flight.markLate();
			}
		}

	}

	public void markFlightCancelend(int numberOfFlight) {
		for (IFlight flight : listFlights) {
			if (flight!=null && flight.getNumberFlight() == numberOfFlight) {
				flight.markCanceled();
			}
		}

	}

	public void addPassInList(int numberOfFlight, IPassenger pass) {
		for (IFlight flight : listFlights) {
			if (flight!=null && flight.getNumberFlight() == numberOfFlight) {
				flight.addPass(pass);
			}
		}

	}

	public void removeFromPassInList(int numberOfFlight, String name) {
		for (IFlight flight : listFlights) {
			if (flight!=null && flight.getNumberFlight() == numberOfFlight) {
				flight.removePass(name);
			}
		}

	}

	public void printLIstOfFlights() {
		for (IFlight flight : listFlights) {
			if(flight!=null)
			flight.printFlightDetails();
		}

	}

}
